import Vue from "vue";
import Vuex from "vuex";
import {setItem,getItem} from "@/utils/storage.js"
Vue.use(Vuex);

const TOKEN_KEY = "TOUTIAO_USER";
const store = new Vuex.Store({
    state:{
        user:getItem(TOKEN_KEY)
    },
    mutations:{
        setUser(state,data){
            state.user = data
          setItem(TOKEN_KEY , JSON.stringify(data))
        }
    }
});
export default store;